<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- creator-coding-edit-mode.qdoc -->
  <title>Working in Edit Mode | Qt Creator Manual</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="index.html">Qt Creator Manual</a></td><td >Working in Edit Mode</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="index.html">Qt Creator Manual 4.11.1</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
  <link rel="prev" href="creator-editor-functions.html" />
  <link rel="next" href="creator-highlighting.html" />
<p class="naviNextPrevious headerNavi">
<a class="prevPage" href="creator-editor-functions.html">Writing Code</a>
<span class="naviSeparator">  &#9702;  </span>
<a class="nextPage" href="creator-highlighting.html">Semantic Highlighting</a>
</p><p/>
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#using-the-editor-toolbar">Using the Editor Toolbar</a></li>
<li class="level2"><a href="#navigating-between-open-files-and-symbols">Navigating Between Open Files and Symbols</a></li>
<li class="level2"><a href="#selecting-parse-context">Selecting Parse Context</a></li>
<li class="level2"><a href="#changing-text-encoding">Changing Text Encoding</a></li>
<li class="level2"><a href="#selecting-line-ending-style">Selecting Line Ending Style</a></li>
<li class="level1"><a href="#splitting-the-editor-view">Splitting the Editor View</a></li>
<li class="level1"><a href="#using-bookmarks">Using Bookmarks</a></li>
<li class="level1"><a href="#moving-to-symbol-definition-or-declaration">Moving to Symbol Definition or Declaration</a></li>
<li class="level1"><a href="#reparsing-externally-changed-files">Reparsing Externally Changed Files</a></li>
<li class="level1"><a href="#inspecting-the-code-model">Inspecting the Code Model</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Working in Edit Mode</h1>
<span class="subtitle"></span>
<!-- $$$creator-coding-navigating.html-description -->
<div class="descr"> <a name="details"></a>
<p>This section describes how to use the <b>Edit</b> mode. For more information about using the sidebar, see <a href="creator-sidebar-views.html">Browsing Project Contents</a>.</p>
<a name="using-the-editor-toolbar"></a>
<h2 id="using-the-editor-toolbar">Using the Editor Toolbar</h2>
<p>The editor toolbar is located at the top of the editor view. The editor toolbar is context sensitive and shows items relevant to the file currently open in the editor.</p>
<p class="centerAlign"><img src="images/qtcreator-editortoolbar-symbols.png" alt="" /></p><a name="navigating-between-open-files-and-symbols"></a>
<h3 id="navigating-between-open-files-and-symbols">Navigating Between Open Files and Symbols</h3>
<p>Use the toolbar to navigate between open files and symbols in use. To browse backward or forward through your location history, click <img src="images/prev.png" alt="" /> (<b>Go Back</b>) and <img src="images/next.png" alt="" /> (<b>Go Forward</b>).</p>
<p>To go to any open file, select it from the <b>Open files</b> drop-down menu (1). To open a context menu that contains commands for managing open files, right-click the file name or icon on the toolbar. In addition to the commands also available in the <b>File</b> menu, you can copy the path and name of the current file and the number of the line where the cursor is currently located to the clipboard by selecting <b>Copy Full Path</b>, <b>Copy File Name</b>, or <b>Copy Path and Line Number</b>.</p>
<p>To jump to any symbol used in the current file, select it from the <b>Symbols</b> drop-down menu (2). By default, the symbols are displayed in the order in which they appear in the file. Right-click the menu title and select <b>Sort Alphabetically</b> to arrange the symbols in alphabetic order.</p>
<p>To jump to a line and column in the current file, select the line and column indicator (3) or press <b>Ctrl+K</b> (or <b>Cmd+K</b> on <a href="nolink">macOS</a>) to open the <a href="creator-editor-locator.html">locator</a>. Enter the line number and column number in the locator, separated by a colon (:).</p>
<p><b>Note: </b>Other convenient ways of navigating in Qt Creator are provided by the <a href="creator-keyboard-shortcuts.html">keyboard shortcuts</a> and the <a href="creator-sidebar-views.html">sidebar</a>.</p><a name="selecting-parse-context"></a>
<h3 id="selecting-parse-context">Selecting Parse Context</h3>
<p>Code might be interpreted differently in different contexts. A file can be used by different projects or subprojects with different defines, or it can be included in the context of C, C++, Objective-C, or Objective-C++. To change the active parse context, select an available parse context in the <b>Active Parse Context</b> menu (4). The menu is visible only when several parse contexts are available. To reset the parse context, right-click on the menu to open a context menu, and then select <b>Clear Preferred Parse Context</b>. If the information needed for parsing the project is still incomplete or incorrect, select <b>Additional Preprocessor Directives</b> to add preprocessor directives.</p>
<a name="changing-text-encoding"></a>
<h3 id="changing-text-encoding">Changing Text Encoding</h3>
<p>To show the file encoding of the current file on the editor toolbar (5), select <b>Tools</b> &gt; <b>Options</b> &gt; <b>Text Editor</b> &gt; <b>Display</b> &gt; <b>Display file encoding</b>.</p>
<p>To change the text encoding, click it on the toolbar and select new encoding in the <b>Text Encoding</b> dialog:</p>
<p class="centerAlign"><img src="images/qtcreator-text-encoding.png" alt="&quot;Text Encoding dialog&quot;" /></p><p>To reload the file with the selected encoding, select <b>Reload with Encoding</b>. To save the file with the new encoding, select <b>Save with Encoding</b>.</p>
<a name="selecting-line-ending-style"></a>
<h3 id="selecting-line-ending-style">Selecting Line Ending Style</h3>
<p>To switch between Windows line endings (CRLF) and Unix line endings (LF), select the ending style on the editor toolbar (6).</p>
<a name="splitting-the-editor-view"></a>
<h2 id="splitting-the-editor-view">Splitting the Editor View</h2>
<p>Split the editor view or open the editor in a new window when you want to work on and view multiple files on the same screen or on multiple screens.</p>
<p class="centerAlign"><img src="images/qtcreator-spliteditorview.png" alt="" /></p><p>You can view multiple files simultaneously in the following ways:</p>
<ul>
<li>To split the editor view into a top and bottom view, select <b>Window</b> &gt; <b>Split</b>, press <b>Ctrl+E, 2</b>, or select the <img src="images/splitbutton_horizontal.png" alt="" /> (<b>Split</b>) button and then select <b>Split</b>.<p>Split command creates views below the currently active editor view.</p>
</li>
<li>To split the editor view into adjacent views, select <b>Window</b> &gt; <b>Split Side by Side</b>, press <b>Ctrl+E, 3</b>, or select <b>Split</b> &gt; <b>Split Side by Side</b>.<p>Side by side split command creates views to the right of the currently active editor view.</p>
</li>
<li>To open the editor in a detached window, press <b>Ctrl+E, 4</b>, or select <b>Window</b> &gt; <b>Open in New Window</b>.<p>The new window behaves basically in the same way as the editor area in the main window. For example, you can split this window, as well. Documents are opened in the currently active editor window.</p>
</li>
</ul>
<p>To move between split views and detached editor windows, select <b>Window</b> &gt; <b>Go to Next Split or Window</b> or press <b>Ctrl+E, O</b>.</p>
<p>To remove a split view, place the cursor within the view you want to remove and select <b>Window</b> &gt; <b>Remove Current Split</b>, press <b>Ctrl+E, 0</b>, or select the <img src="images/splitbutton_closetop.png" alt="" /> (<b>Remove Split</b>) button. To remove all but the currently selected split view, select <b>Window</b> &gt; <b>Remove All Splits</b> or press <b>Ctrl+E, 1</b>.</p>
<a name="using-bookmarks"></a>
<h2 id="using-bookmarks">Using Bookmarks</h2>
<p>To insert or delete a bookmark:</p>
<ul>
<li>Right-click the line number and select <b>Toggle Bookmark</b>.</li>
<li>Press <b>Shift</b> and click the left margin at a line.</li>
<li>Press <b>Ctrl+M</b> when the cursor is on a line.</li>
</ul>
<p class="centerAlign"><img src="images/qtcreator-togglebookmark.png" alt="" /></p><p>To add a note to a bookmark, right-click the bookmark and select <b>Edit Bookmark</b>. To view the note, move the mouse pointer over the bookmark.</p>
<p>To go to the previous bookmark in the current session, select <b>Tools</b> <b>Bookmarks</b> &gt; <b>Previous Bookmark</b> or press <b>Ctrl+,</b>.</p>
<p>To go to the next bookmark in the current session, select <b>Tools</b> <b>Bookmarks</b> &gt; <b>Previous Bookmark</b> or press <b>Ctrl+.</b>.</p>
<p>To use the locator to go to a bookmark, press <b>Ctrl+K</b> (or <b>Cmd+K</b> on <a href="nolink">macOS</a>) to open the locator. Enter <i>b</i> and a space to display a list of bookmarks. To filter the bookmarks by line number or a text string, enter the number or string after the space. Double-click a bookmark in the list to go to it in the editor.</p>
<p class="centerAlign"><img src="images/qtcreator-locator-bookmark-filtering.png" alt="&quot;Filtering bookmarks in locator&quot;" /></p><p>Bookmarks are listed in the <b>Bookmarks</b> view in the sidebar. To move between bookmarks, select the <b>Previous Bookmark</b> or <b>Next Bookmark</b> button or use the keyboard shortcuts.</p>
<p class="centerAlign"><img src="images/qtcreator-bookmarks-view.png" alt="&quot;Listing bookmarks in Bookmarks view&quot;" /></p><a name="moving-to-symbol-definition-or-declaration"></a>
<h2 id="moving-to-symbol-definition-or-declaration">Moving to Symbol Definition or Declaration</h2>
<p>You can move directly to the definition or the declaration of a symbol by holding the <b>Ctrl</b> key and clicking the symbol. If you have multiple splits opened, you can open the link in the next split by holding <b>Ctrl</b> and <b>Alt</b> while clicking the symbol.</p>
<p>To enable this moving function, select <b>Tools</b> &gt; <b>Options</b> &gt; <b>Text Editor</b> &gt; <b>Behavior</b> &gt; <b>Enable mouse navigation</b>.</p>
<p>There are several additional ways of moving between symbol definitions and declarations. All the functions described below are also available from the <b>Tools</b> &gt; <b>C++</b> menu. The functions supported for QML and JavaScript code are available from the <b>Tools</b> &gt; <b>QML/JS</b> menu.</p>
<p>You can select the symbol and press <b>F2</b>, or right-click the symbol and select <b>Follow Symbol Under Cursor</b> to move to its definition or declaration. To follow the symbol in the next split, select <b>Follow Symbol Under Cursor in Next Split</b>. Following symbols is supported for namespaces, classes, functions, variables, include statements, and macros.</p>
<p>To switch between the definition and declaration of a function, place the cursor on either and press <b>Shift+F2</b> or right-click and select <b>Switch Between Function Declaration/Definition</b> or <b>Open Function Declaration/Definition in Next Split</b>. For example, this allows you to navigate from anywhere within a function body directly to the function declaration.</p>
<p>Links are opened in the same split by default. To open links in the next split, prepend <b>Ctrl+E</b> to the shortcut. For example, press <b>Ctrl+E,F2</b> to follow the symbol in the next split. If necessary, the view is automatically split. To change the default behavior, select <b>Tools</b> &gt; <b>Options</b> &gt; <b>Text Editor</b> &gt; <b>Display</b> &gt; <b>Always open links in another split</b>. Additional symbols are displayed and switching between definition and declaration is done in another split. If you change the default behavior, the shortcuts for opening link targets in the next split are used to open them in the current split.</p>
<p>To switch between C++ header and source files, right-click anywhere in a file and select <b>Switch Header/Source</b> or <b>Open Corresponding Header/Source in Next Split</b>. You can also press <b>F4</b> or <b>Ctrl+E,F4</b>, respectively.</p>
<a name="reparsing-externally-changed-files"></a>
<h2 id="reparsing-externally-changed-files">Reparsing Externally Changed Files</h2>
<p>If source files are modified from outside Qt Creator, the opened files will be reparsed automatically. For all other files, you can use <b>Tools</b> &gt; <b>C++</b> &gt; <b>Reparse Externally Changed Files</b> to update the code model.</p>
<a name="inspecting-the-code-model"></a>
<h2 id="inspecting-the-code-model">Inspecting the Code Model</h2>
<p>When you report a bug that is related to the C++ code model, the Qt Creator developers might ask you to write information about the internal state of the code model into a log file and to deliver the file to them for inspection.</p>
<p>To view information about the C++ code model in the <b>C++ Code Model Inspector</b> dialog and write it to a log file, select <b>Tools</b> &gt; <b>C++</b> &gt; <b>Inspect C++ Code Model</b> or press <b>Ctrl+Shift+F12</b>.</p>
<p>Qt Creator generates the code model inspection log file in a temporary folder.</p>
<p>Qt Creator underlines semantic errors in olive in the C++ code editor. To check the correct paths for includes that are not resolved or that are resolved to the wrong file, select <b>Project Parts</b> &gt; <b>Header Paths</b>.</p>
</div>
<!-- @@@creator-coding-navigating.html -->
<p class="naviNextPrevious footerNavi">
<a class="prevPage" href="creator-editor-functions.html">Writing Code</a>
<span class="naviSeparator">  &#9702;  </span>
<a class="nextPage" href="creator-highlighting.html">Semantic Highlighting</a>
</p>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
